Use react hooks: useState and useRef.
